Avoid undefined indexes