patched script functions