Fix ordering bug in type management (compiler)