Additional code to prevent infinite error loops.