fix mac os x work (?); move common global vars to globals.js