Avoid use of deprecated table.getn.

table.getn is deprecated function in Lua 5.1 left for compatibility
with 5.0, use # operator instead.

Also, fixed typo.