fixed bug where a wrong path would be returned when image was already on disk