fixes #55, added also a test for that bug

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