improve warning message when indexing a nil type