fixed a bug about missing null check on createUser