fix case where username variable is used to validate the username before the username variable is actually set. using this.params.username now, and also making sure core.isValidUsername function checks for undefined. tests updated