better handling of conditionally required keys