Added forest validity check