Fix some casts from pointer to int, now cast to intptr_t