Refactor UserRegistratioNServlet and fix some bugs