update module quit to handle exception