Fixed timed_queue and added a test for it