Some fixes on arrayCompare function