register related bugs fixed