added memory releasement of array objects