fixes to applying handlers to UIAppearance, but uncovered a bug when using `when_contained_in`