bugfix: don't use table.insert when nil can be insert