Fixed the infinite error message bug