Fixed flag issues