fix various bugs
Merge pull request #4 from maxogden/fixes

fix various bugs