Better code, checks if image is broken and tries to find another