rewritten self patching