Fixes coordinate calculation errors.