bugfix: undefined method '[]' for nil:NilClass