fixed some bugs and layout issues