improved patching