fix for bad stack index in moailuaclass after 787 merge
Fix for compiling in release mode (templates need to be present at instantiation time)