Bug fix for 'undefined method name' for nil:NilClass'. Only ignore the nil variable