Fix register
Merged with emeline's commit
Merged with emeline's commit