Fix: Correct offset calculation errors