Fixing database handler