Fix bugs and fix master page