before updating layout