Fixed testing errors in karma and mocha