Synchronization fixes

Should contain most fixes for the issues identified by _ThreadSafe_.

Nothing really urgent, but then also nothing really dangerous preventing a quick integration I think.