Improve flag handling

Don't return weirdly for non-existent flags.