Fixed a caching bug in case of resizing.