properly detect undefined view