fixed bug in layout selection