Added check for error