fix console application bugs