fix deadlock in condition wait whenever there are multiple waiters