Add some additional casts to unsigned long to prevent 64-bit iPad warnings