fixing table sort