Fixed branching mistakes

Mocha tests are possible now