[fix] prevent use of undefined indexes