diff --git a/server/djrandom/frontend/static/player.js b/server/djrandom/frontend/static/player.js
index 3e739f6a733a7ff3c36a0f53b72cd4cb1ea4fce6..a27642c0296304fcf7385515bba4a61c74bd59f2 100644
--- a/server/djrandom/frontend/static/player.js
+++ b/server/djrandom/frontend/static/player.js
@@ -112,12 +112,11 @@ djr.Playlist.prototype.allSongs = function() {
 // Creates a new chunk with only unique songs.
 djr.Playlist.prototype.createUniqueChunk = function(songs, title) {
   var songs = [], i;
-  for (i = 0; i < playlist_chunk.songs.length; i++) {
-    var song = playlist_chunk.songs[i];
-    if (this.song_map[song] != null) {
+  for (i = 0; i < songs.length; i++) {
+    if (this.song_map[song[i]] != null) {
       continue;
     }
-    songs.push(song);
+    songs.push(song[i]);
   }
   if (songs.length > 0) {
     return new djr.PlaylistChunk(songs, title);