reset function, fix #69 and #72