Fix a batch of issues caused by jQuery mobile loading multiple pages.