#939: Fix median crash on null value
#939: Refactor tests to cover this issue