fix waitWithSemaphore return type