Fixed the build on MSVC.

Local variables need to be declared at the start of the block.
Fix typo in bf703c4a8f95db4859452474499038c7539ea3c7.