fixes a bug in the branching and now the j is tested