Fix va_list usage, or it will not work the right way on Windows

These are issues not yet fixed to win32 build.

`types_count` is the last parameter before `...`, not `types_length`.
Besides, there is a `va_start(ap, types_count);` statement in the following code.