Numpy compat

Patch for part of issue #149.