Fix a pointer arithmetic error in the original version