Issue #65: moved code to within synchronization block

This problem was successfully detected by the VERIFY_LOCK conditional flag.