fix bug, add console mode