Bug fixes for queue