Fix typo
Remove redundant error checking, add test cases