updated for backward compatibility with Python 3.0/3.1 via using optparse there