More robust to numpy versions