Change set_ainv method