Added error for data rank>2