Nested conditions not resetting when parent value is changed