Fixed resize on unmaximize, added index check to cache function