fixed "Undefined index" issues