reset added; function seperated
split strmap to strmapbuf
casts adjusted