Solved problem reported

see #27 

todo 
- [x] fixed bug
- [x] unit test that reproduce the error
- [ ] more unit tests

I made this in hurry, it'd work, I'm going to add Unit tests.