fixing bug in register