improved imagegrid and fixed performance issues in reading metadata