Fix #174 ptr() panic on uintptr

I also added a check for the slice length before calling index.