core: only look for global flags before "--" [GH-2491]