Fix hex substring indexes