fixed undefined task for the wait_task method