fixed some DB locking issues