Fixing Script function