Fixed buffer dequeuing bug