fixed bug in which in certain situations certain patterns could cause a nil to be used as a table index