fixed formula for global position