Made a bug fix to Register