Fix few deprecation warnings. Fix mainClass option handling.