fixed bugs with queue management