fix looping null pointer exception in insertTicket