fixed Wait() and Lock() for better signal interrupt handling code
pull