Fixed issues relating to AppleScript