Add --resetall option and bug fix