Fix nodehandle constructor

The previous fix (with the for loops) did not fix the problem. Specifically there were two errors:
* using sizeof(...) does not give the number of elements of the array (unless it's a 1 byte type)
* ptr was not increased (e.g. it should have been *(ptr+i))

I've tested this patch and it seems to work fine.