Bug fix: offset needs be relative from pos if it is to be used as an index into array