bugfix: can't convert nil to integer