Fix for locking issues in redmine/6334

Smells of debug code you forgot to delete ...