convert ndarrays to lists for compatibility with python2.6