fixed the buffer overflow detected problem