Fix some possible segfaults with HW render.