diff --git a/test/test_mapvisualization.py b/test/test_mapvisualization.py
index c2a6c781d1dc77c7401847098a3a252b331128b4..ba4c2cb176024fa07feb28269951d71bc9f74454 100644
--- a/test/test_mapvisualization.py
+++ b/test/test_mapvisualization.py
@@ -50,4 +50,3 @@ class testclassDialogTest(unittest.TestCase):
 
 if __name__ == "__main__":
     unittest.main()
-app.exec_()
\ No newline at end of file
diff --git a/test/test_plotstyling.py b/test/test_plotstyling.py
index 298761185821a43e71c88119bab07eb799dd8291..2951f9fe03af696743712ba7db986ccf742a549b 100644
--- a/test/test_plotstyling.py
+++ b/test/test_plotstyling.py
@@ -54,7 +54,6 @@ class TestPlotStyling(unittest.TestCase):
         s1.markerPen.setColor(QColor('yellow'))
 
         s2 = PlotStyle(plotStyle=s1)
-
         self.assertEqual(s1,s2)
 
 
@@ -67,8 +66,9 @@ class TestPlotStyling(unittest.TestCase):
             d.setPlotStyle(s1)
         except Exception:
             self.fail('Unable to initialize PlotStyleDialog')
-
-        self.assertEqual(s1, d.plotStyle())
+        s2 = d.plotStyle()
+        self.assertIsInstance(s2, PlotStyle)
+        self.assertEqual(s1, s2)
 
         try:
             btn = PlotStyleButton()
diff --git a/timeseriesviewer/plotstyling.py b/timeseriesviewer/plotstyling.py
index df330f922cad15e6262383c4b665c0e8de9029f3..b3039ae54852d2de9f3c85e6250ad21f63952880 100644
--- a/timeseriesviewer/plotstyling.py
+++ b/timeseriesviewer/plotstyling.py
@@ -63,7 +63,7 @@ class PlotStyle(QObject):
         super(PlotStyle,self).__init__(**kwds)
 
         self.markerSymbol = MARKERSYMBOLS[0].mValue
-        self.markerSize = 10
+        self.markerSize = 5
         self.markerBrush = QBrush()
         self.markerBrush.setColor(Qt.green)
         self.markerBrush.setStyle(Qt.SolidPattern)
@@ -71,11 +71,13 @@ class PlotStyle(QObject):
         self.backgroundColor = Qt.black
 
         self.markerPen = QPen()
-        self.markerPen.setStyle(Qt.SolidLine)
+        self.markerPen.setStyle(Qt.NoPen)
         self.markerPen.setColor(Qt.white)
 
+
         self.linePen = QPen()
         self.linePen.setStyle(Qt.NoPen)
+        self.linePen.setWidth(0)
         self.linePen.setColor(QColor(74, 75, 75))
 
         self.mIsVisible = True
@@ -213,7 +215,7 @@ class PlotStyleWidget(QWidget, loadUI('plotstylewidget.ui')):
         self.sbMarkerSize.valueChanged.connect(self.refreshPreview)
         self.sbMarkerPenWidth.valueChanged.connect(self.refreshPreview)
         self.sbLinePenWidth.valueChanged.connect(self.refreshPreview)
-
+        self.mLastPlotStyle = None
 
         self.setPlotStyle(PlotStyle())
         self.refreshPreview()
@@ -239,7 +241,7 @@ class PlotStyleWidget(QWidget, loadUI('plotstylewidget.ui')):
     def setPlotStyle(self, style):
         assert isinstance(style, PlotStyle)
         #set widget values
-
+        self.mLastPlotStyle = style
         self.mBlockUpdates = True
         self.sbMarkerSize.setValue(style.markerSize)
         #self._setComboBoxToValue(self.cbMarkerSymbol, style.markerSymbol)
@@ -272,7 +274,8 @@ class PlotStyleWidget(QWidget, loadUI('plotstylewidget.ui')):
         return icon
 
     def plotStyle(self):
-        style = PlotStyle()
+        style = PlotStyle(plotStyle=self.mLastPlotStyle)
+
         #read plotstyle values from widgets
         style.markerSize = self.sbMarkerSize.value()
         symbol = currentComboBoxValue(self.cbMarkerSymbol)
@@ -281,17 +284,19 @@ class PlotStyleWidget(QWidget, loadUI('plotstylewidget.ui')):
         assert isinstance(style.markerBrush, QBrush)
         assert isinstance(style.linePen, QPen)
 
-        style.markerPen = pg.mkPen(color=self.btnMarkerPenColor.color(),
-                                   width=self.sbMarkerPenWidth.value(),
-                                   style=currentComboBoxValue(self.cbMarkerPenStyle))
-
+        style.markerPen.setColor(self.btnMarkerPenColor.color())
+        style.markerPen.setWidth(self.sbMarkerPenWidth.value())
+        style.markerPen.setStyle(currentComboBoxValue(self.cbMarkerPenStyle))
 
-        style.markerBrush.setColor(self.btnMarkerBrushColor.color())
         style.markerBrush.setColor(self.btnMarkerBrushColor.color())
 
-        style.linePen = pg.mkPen(color=self.btnLinePenColor.color(),
-                                 width=self.sbLinePenWidth.value(),
-                                 style=currentComboBoxValue(self.cbLinePenStyle))
+
+        #style.linePen = pg.mkPen(color=self.btnLinePenColor.color(),
+        #                         width=self.sbLinePenWidth.value(),
+        #                         style=currentComboBoxValue(self.cbLinePenStyle))
+        style.linePen.setColor(self.btnLinePenColor.color())
+        style.linePen.setWidth(self.sbLinePenWidth.value())
+        style.linePen.setStyle(currentComboBoxValue(self.cbLinePenStyle))
 
         return style
 
@@ -379,11 +384,11 @@ class PlotStyleDialog(QgsDialog):
         buttonBar = QHBoxLayout()
         #buttonBar.addWidget(self.btCancel)
         #buttonBar.addWidget(self.btOk)
-        if plotStyle:
-            self.setPlotStyle(plotStyle)
         l = self.layout()
         l.addWidget(self.w)
         l.addLayout(buttonBar)
+        if isinstance(plotStyle, PlotStyle):
+            self.setPlotStyle(plotStyle)
         #self.setLayout(l)
 
 
@@ -409,10 +414,12 @@ if __name__ == '__main__':
     assert isinstance(s2, PlotStyle)
     #btn = QgsSymbolButton()
 
+    #btn = QgsSymbolButton()
+    #btn.show()
     d  = PlotStyleDialog()
     d.exec_()
 
-    btn = PlotStyleButton()
-    btn.show()
+    #btn = PlotStyleButton()
+    #btn.show()
     qgsApp.exec_()
     qgsApp.exitQgis()
diff --git a/timeseriesviewer/utils.py b/timeseriesviewer/utils.py
index eb35f91cb1fec904b25fc607324a994167fbec1c..6bfc079956550a5cb3193f9a757fd2b6b73ce978 100644
--- a/timeseriesviewer/utils.py
+++ b/timeseriesviewer/utils.py
@@ -685,6 +685,7 @@ def loadUIFormClass(pathUi, from_imports=False, resourceSuffix=''):
 
         #remove new-lines. this prevents uic.loadUiType(buffer, resource_suffix=RC_SUFFIX)
         #to mess up the *.ui xml
+
         f = open(pathUi, 'r')
         txt = ''.join(f.readlines())
         f.close()
@@ -734,6 +735,7 @@ def loadUIFormClass(pathUi, from_imports=False, resourceSuffix=''):
             FORM_CLASS, _ = uic.loadUiType(pathUi, resource_suffix=RC_SUFFIX)
 
         buffer.close()
+        buffer = None
         FORM_CLASSES[pathUi] = FORM_CLASS
 
         #remove temporary added directories from python path