bug fixes

i hate a few problems with the database, try it moti