Fix bug when using median/mean for input2