convert code to string first

this won’t raise an exception if you pass in a nil values