Fix #64 issue and some undefined index notices

Fix #64 issue and some undefined index notices