add inv to Kgen