Fixes application logic for login