crappy little sprintf implementation