Trying to do a nil check.

This might fix the problem with username == nil