median: handle nulls, add tests