bugfix for buffer overflow