merge from 2.2 - fix parsing of options