More important bugfixes (locking)