fix position comparison