added check for calls to Object.wait()