Fix bug with array purging