add -g to use text or graphic mode
modify some rule