fixing some stupid errors and recommiting

I forgot to commit and got a crash. this is what i have nog. need to
rework some database code again....