Well now we know what is wrong.
Things look a little off with the first one created by your script. However it is easy to tell the problem
Your script is not setting the Bo_Read_Perm
In a regular forum this is set when you create the forums and edit which groups have access. Your script is creating the forum but no one has access. Try editing the forums from the admin area and giving the groups access and see if the access deny error dissapears. You will notice the groups are listed like this in your attachment
-1-2-3-4-
Under the attachment your script created forum is lacking these.
Now back to looking at the code to see why things aren't set.