Fix crashing bug and improve page load speed