Fixed some annoying errors, getTickets sql statement is problematic.