Remove uses of deprecated table.getn