rewrite callback