fix inverting