Better flags checking