Added invalid forest check