Fixed bug in producing errors