Move pending_version check into loop