Refactor code, fix bug that error message is still shown when going back to enroll page from enroll result page