Fix memory issue when enumerate all photos