patching function added