catching undefined name for base layer and a bit of debug code.