fixing undefined index message