Fixing database writes
Removed futile attempts to handle db locks