Fix #89 & add test coverage