Bugfix for computing offset for A*