fixes in db
clean up code