I created a lua function (see viewtopic.php?f=69&t=28550), which generates an image of the map (is there a native function for it?). Therefore I wanted to write a "\0" byte out (for coal) and detected data is handled as zero terminated string and not as a buffer and length.