Correct array deallocation