trying to figure out this median error