Fix register bug