Replaces spaces in username.

Fixes  #1338.

It replaces  #1339 which had merge conflicts.