Added missing check for error.