fix the inverse to remove code duplication
(#524)