Added support for caching image mask