Fixed median bug