fix resizing crash

clean fix for resizing crash.