Fix bug involving offset