Fix for db locking issues