Fixed several undefined variable / undefined index notices