Add __numpy_ufunc__, adjust tests, remove numpy-dev bugs (closes #2483, #2492)