Fixed and added tests.