Make rewrite functions work [skip ci]