Fixed  warnings in 64bit mode by casting size_t to int