Smarter way of handling playlist indices, fixes #353