#226 Fix undefined index errors