Fixed #4566: Fix bugs with LayerGradient constructor fix