Minor fixes + added tests.