improve option parsing