fixed recursive array removal