rewrite adt patcher