Fixing bug when value does not respond to length