handle array shape
Merge pull request #1 from hadim/master

handle 3D and 4D shape