Fix segmentation fault on resolution change