Fixed some flag parsing issues