optimize validation of register