Fixed casting issue from unsigned long to int32_t