Fix concurrency bug in image producers.

Reported by Michael Marina.