Fix bug when toggling renderer