minor bugfix

There was a bug and a few other things that i felt i should fix and
commit asap