Resolve the problem that print_pat() crashes