fix the core dump,need sort the code