Remove extra return from median calculation
Extra return might comes from SortValues function. Use Trim4 custom function to remove it.

Trim4 ( SortValues ( beak.trait; 1) )

Use it for MiddleValues functions too.