Login checks and initialisation code fixed