modified offset calculation (still strange results)