Fixes dynamic resizing bug.