fixed potential buffer overflow