add tests and code to prevent NoMethodError: undefined method `split' for nil:NilClass`