Issue #3380107 by acbramley: optionExists throws exception with incorrect type if option doesn't exist (cherry picked from commit 26354a12)