fixed code for register