fix some output bugs