Try to protect the db with a mutex