change compare operator in array and free flags in RingQueue