Fix various issue of registration and login