fixed console application bugs