before layout