update from upstream.
improved robustness.
removed obselete options.