add check in register method
register function