Pr/447

added a test case for the pull request. also fixed a bug.