fixing database usage