fixing random tree generation