Fixed a bug on log in functionality