179 avoid code duplication (#179)
fix error position