Minor fixes to patching system.