fixed talloc logic from ((dim != 1) || (dim != 2)) to ((dim != 1) && (dim !=2))