Make pull-sugar-libs.sh more robust