throwing indexerror when trying to access table results out of bounds