Fix problem in resize handler

Issue #2233