sort value according to the type