Fix some layout bugs and dispatch js views automatically