Handle undefined positions gracefully