Fix #64 issue and some undefined index notices