fixed loggin condition