max_depth was not respected when creating nodes - close #544