Casting unsigned long to unsigned int to avoid compiler warnings