Fix the linenoise history issue which could cause the system crash