This is a workaround for locking on window, because locking does currently not work on windows.

It also fixes the crash on windows.