Fixed several problems with filters and flags.