fixed bug when using console