sorting arrays before testing to make sure they are equal