Add new lines to debug log
Fix incorrect boolean logic
Fix incorrect boolean logic for locking