Fix MSVC6 /W4 warnings

about implicit type conversion and possible data loss