Fixed and added some tests.