Fix database lock