before filling in layout