fix rubocop nil checks