replace spaces in username on several places

this function may need to be used on some other places as well to make
sure this is working, but I didn't find any so far