fixed logic to detect view