bugfix in new_rewrite_rhs