this ravels, as far as I can see, and will produce wrong results if a is 2d