Added generic engine globals and moai globals.
Fixed a cople bugs.