fix some c output bugs