fixed #1 & updated tests to catch the bug