fixed minor bugs, database does not work with incorrect data in database
first commit
fixed stuff, needs clean data to work