Fixed a bug and added more tests for multidim.