position calculation fix