layout code fixes