Fixed buffer overflow issue