fix for # of inv being wrong