Fixed issue 62/64 lock: can't be called from trap context