options: refactor repeated code in option setting