inverse now implemented correctly