Fix for issue 3458

See: https://github.com/numpy/numpy/issues/3458