Added check in register function.