Fixed bug 1828 and added unit test
Merge remote-tracking branch 'upstream/master' into fix-bug-1828
Merge pull request #37 from davidleibovic/fix-bug-1828

unit tests pass, code looks good.