added a z3 restart limit to avoid infinite loop