fix several problems including the reset problem