checking for error