Merge changes Iab3556ef,I27a4c9e4 into main

* changes:
  Wait for --remote-image-dir to be initialized
  Count references to --remote-image-dir