Fix typo in comments and function name ('foriegn' to 'foreign')