Bug fixed as generate function was returning total no of errors.