fixed flag parsing