fixed bug where NULL strings would crash the format() function