WARNING: This causes failures in some tests, but it is the first step to finer grained locking