fix the return value of sprintf