fixing bugs in layout