Correct a few errors in the wait-for-images code.