Fixes for #51 , #53 and #54

I hope this is good enough, it passes all rspec tests