Fix register and add error messages