Fixed some output errors and some hidden errors