changed checking if image exist to file reader