Fix minor typo bug
Add error handling