Some undefined indexs and a tweak

Hopefully the tweak will not break too much. :innocent: