fix pointer arithmetic