Fix buffer overflow (2), fix #7