utils.getOpts: avoid index out of range