added more function when registering user