modifications to better support multi-dimensional statfunction output