Fixed bugs for console output