Fixed locking bug, squelched compilation warnings