fixed code for without coroutines