sort at input so it's quick for output
fix bug of using url() in l()