Update while method parameter

Updated while loop parameter as image collection with only one page was
failing.