Bug fixes on registration