fix #85 + tests