                     return 0
                 }
                 return enqueuedItems?.indexOf { $0.position == index } ?? 0
-                }()
+            }()
+            currentItemIndexInQueue = startIndex
             currentItem = enqueuedItems?[startIndex].item
-            currentItemIndexInQueue = startIndex
         }
         else {
             stop()

            else {
                connectionLossDate = NSDate()
                stateWhenConnectionLost = state
                state = .WaitingForConnection
            }
        }
    }

            }
        }
        else if state != .Stopped && state != .Paused {
            if reachability.isReachable() || (currentItem?.soundURLs[currentQuality ?? defaultQuality]?.fileURL ?? false) {
                retryOrPlayNext()
                connectionLossDate = nil
                stateWhenConnectionLost = nil
