fix UB in ReadArrayOfIntPtr

closes #86