Slightly improve wrap collision code