Fixed error and added some tests.