fix minor undefined indexes