added branching to spouts

also fixed some pointer exceptions