Fix typeof undefinition error on Mac