fix bug in sprintf