Restore create_script func, fixed #1687