fixes #55, added also a test for that bug

fixes #55, I made a big test in order to find the bug, then i fixed it. In tests I believe :dancer: