Ensure correct context is active during resize