general fixes and imrpovments in image cache handling