Fix "attempt to get length of field '?' (a nil value)"