Core: simplify code
Core: rename DatabaseLocked to DatabaseLockedError
Coreaux: fix bug