Fix nonlocal image problem

This is my proposed solution to the issue raised in my comment to f50df31f.