Fix metadata break when any of the paratemers to the Format function are null
Merge pull request #799 from prasannavl/upstream

Fix metadata break when any of the paratemers to the Format function are null.
make shorter and more readable