Fix #5: proper swap operation of queue