Fix trimming meta string

Handle case when meta is nil or not a string because s-trim cannot be
used with input other than a string.