Fix: added condition for error in error checking process