Added check for resultant shape