close #50 fixed, the bug, and added a test