Fixed typos
Cast result to array.
merge 4.0 branch to master. fix conflicts.