Issue #491, adding rspec tests
Issue #491, fixing a bug