Fixed a ton of bugs i found in a row

fixes #202
MIssed checkin