Fixed an IllegalMonitorStateException (I think).