fixes a crash problem caused by circular dependency in layout