Fixing issues to pass mocha tests.