added reset and some fixes