Bugfix in queue management/cleanup