be sure to always release lock when exception occurs