Fixed type conversions (warnings in MSVC)