diff --git a/resources/lib/player.py b/resources/lib/player.py
index 9ff6d178..0dca7b63 100644
--- a/resources/lib/player.py
+++ b/resources/lib/player.py
@@ -496,7 +496,11 @@ class Player(xbmc.Player):
                 else:
                     playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
 
-                if playlist.getposition < 0:
+                if int(playlist.getposition()) < 0:
+                    ''' If playback is stopped within the first 30 seconds,
+                        Kodi doesn't consider this watched and playlist should not be cleared.
+                        When the end is reached, position is -1.
+                    '''
                     log.info("Clear playlist, end detected.")
                     playlist.clear()
 
diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py
index 40bf9bd5..f8968f08 100644
--- a/resources/lib/playutils.py
+++ b/resources/lib/playutils.py
@@ -4,6 +4,7 @@
 
 import collections
 import logging
+import os
 import urllib
 
 import xbmc