fix UnboundLocalError error
add audit_log
modify Ticket model