db locking issues fix #2