add a bit of protection around the init and the login methods for ios