fix bug in queue