change pointer type to uintptr_t for portability