Small fix with error handling