Porting of #3580 to support

Close #3580