Fixed error with undefined index