Added error handling.
Fixed spelling error.