Fixed casts and strcasecmp for MSVC