fixed typo, replaced error handling