resetCode in some scenarios