Fix flag parsing