Properly handle non-string args

This fixes arguments which came from a non-string (i.e. API) source.
This issue was introduced recently in pull request #11368.