Bug fixes

Fixes issue #55 
Just realized some of the stuff that I pulled from frank I didn't want in there, I recently amended a commit.