fixed bugs in layout