Adds fixes from colony-luajit branch.

These are all the fixes from the luajit branch that don't involve changing interpreters. These changes work on master, but are also blockers for proper operation under luajit (for various strictness and minor API differences).