Fix undefined []:nilClass