Completed Register user's avatar

and fix some bugs