queue now correctly waits if no task is available