changed max, min to max_elemwise, min_elemwise