* fix crash of trying to unlock an unlocked mutex
* redirect error message to file