Fix vector access in error message.
Use explicit conversions to avoid a few warnings in VC++11.