bug fix and layout helpers