CGIV-2253 only loop if it has the key