call array.tolist() instead of list(array) to handle n-dimensional
arrays