Fix to avoid a crash on bounds-check fail