fixed minor bug with inv