only update the layout when it is really needed