Fix free
Add missing casts to uintptr_t