Don't call #first on images that are not present.

Fixes #593