fixed a buffer overwrite