bugfixes and reflash support