adding check to verify tickets variable is not empty