bug fixes
use getopt() for parsing command line arguments, add --username option