Fixed locking problems.