Fix ordering bug in types parsing