some fixes and code cleaning to the user generation.