
See https://stackoverflow.com/questions/47648689/sealed-classs-objects-mysteriously-becoming-null-when-referenced-by-other-compa (cherry picked from commit c0e2eb211daefe47803d93161f896c6d5011a0ff) (cherry picked from commit 5077000f52534f3d65a91ad373837fe5c7859485)