fixed #5 + tests