fix the double character output issue