fix #54 + tests