Fixed an issue with the insert ticket sql