changing task continuation to prevent deadlock