corrected inversion bug in rm_features