Fixing if-else login issue