add overwrite_input to np.median to avoid memory error