reduce offset calculation
fix issue 165 #165