Ticket Bug Fix

Fixed a bug in the ticket form validation and optimized some code.