Fixing problem with context being undefined on Mac