fix the coredump bug and improve code block