Made playlist mode robust. fixes invalid index
method calls on empty playlist, & bugfix in isValidPlaylist()

isValidPlaylist() logic for nonempty playlist incorrectly check validity
of index. (line 315).