Handle nil and non-string values better.