Fixing ordering bug with queue-top vs. dequeue.

jira : QUES-81