Fix nonempty logic
Fix condition for special view loop