added unit test and fixed typo