Fixing error handling bug resulting from typo