Fixed finding closest point