added debug mode checks for ambiguous layouts