• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
like if you change your realm and play a newly established prince in byzantine empire, just for the fun of it.

but, something, something has to make the ai change laws now and then.

i'm not sure if it's a bug or wad, but loyalty bonus/penalty depends on the laws of the vassal, not the liege. so, without such events, royal preorgatory and feudal contract don't work.
 
Two new events for changing succession laws (the first one will especially fit Byzantium when it gets a strong ruler):

Code:
#########################
#Dynasty establishes itself
#########################
character_event = {
     id = 20018

     picture = "event_intrigue"
     name = "Dynasty establishes itself"

     trigger = {
              condition = { type = ruler }
              condition = { 
                  type = or
                  condition = { type = has_law value = { royal_preorgatory_law  = yes } }
                  condition = { type = has_law value = { feudal_contract_law  = yes } }
              }
              condition = { type = has_law value = { elective_law  = yes } }
              condition = {
                  type = or
                  condition = { type = diplomacy value = 10 }
                  condition = { type = martial value = 10 }
                  condition = { type = stewardship value = 10 }
              }
              condition = {
                  type = not
                  value = { type = religion value = pagan }
              }
     }

     mean_time_to_happen = {
              months = 240
              modifier = {
                  condition = { type = duchy }
                  factor = 0.75
              }
              modifier = {
                  condition = { type = kingdom }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = year value = 1300 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = year value = 1400 }
                  factor = 0.9
              }
     }

     action_a = { # Claim the throne for my dynasty
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = arbitrary }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = energetic }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = selfish }
				factor = 1.5
			}
			modifier = {
				condition = {
					type = any_vassal
					condition = {
						type = not
						value = { type = loyalty value = 1 }
					}
				}
			factor = 0.1
			}
			#end AI modifier block
		effect = { type = set_law value = semisalic_primogeniture_law }
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = arbitrary }
		}
     }
     action_b = { # Keep the old succession laws
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = modest }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = just }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = prestige scale = -0.1 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = just }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = modest }
		}
     }
}

#########################
#Feudalism takes root
#########################
character_event = {
     id = 20019

     picture = "event_joust"
     name = "Feudalism takes root"

     trigger = {
              condition = {
                 type = or
                 condition = { type = is_independent }
                 condition = { type = is_vassal }
              }
              condition = { type = year	value = 1100 }
              condition = { type = has_law value = { traditional_custom_law  = yes } }
              condition = { type = religion value = catholic }
     }

     mean_time_to_happen = {
              months = 900
              modifier = {
                  condition = { type = duchy }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = kingdom }
                  factor = 0.7
              }
              modifier = {
                  condition = { type = has_vassal }
                  factor = 0.8
              }
              modifier = {
                  condition = { type = year value = 1200 }
                  factor = 0.8
              }
              modifier = {
                  condition = { type = year value = 1300 }
                  factor = 0.5
              }
     }

     action_a = { # Accept feudalism
		ai_chance = 70
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = just }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = wise }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = set_law value = feudal_contract_law }
		effect = { type = prestige scale = 0.1 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = generous }
		}
     }
     action_b = { # Increase royal power instead
		ai_chance = 20
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = arbitrary }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = set_law value = royal_preorgatory_law }
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = arbitrary }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
     }
     action_c = { # Leave things as they are
		ai_chance = 10
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = prestige scale = -0.1 }
     }
}

#########################
#Royal power increases
#########################
character_event = {
     id = 20020

     picture = "event_claim"
     name = "Royal power increases"

     trigger = {
              condition = { type = kingdom }
              condition = { type = year value = 1250 }
              condition = { type = religion value = catholic }
              condition = {
                 type = or
                 condition = { type = has_law value = { feudal_contract_law = yes } }
                 condition = { type = has_law value = { traditional_custom_law  = yes } }
              }
     }

     mean_time_to_happen = {
              months = 900
              modifier = {
                  condition = { type = year value = 1350 }
                  factor = 0.7
              }
              modifier = {
                  condition = { type = diplomacy value = 8 }
                  factor = 0.9
              }
              modifier = {
                  factor = 1.5
              }
              modifier = {
                  condition = { type = not
                            value = { type = diplomacy value = 3 }
                  }
                  factor = 1.5
              }
              modifier = {
                  condition = { type = prestige value = 1000 }
                  factor = 0.7
              }
              modifier = {
                  condition = { type = trait value = coward }
                  factor = 2
              }
              modifier = {
                  condition = { type = trait value = energetic }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = trait value = generous }
                  factor = 1.2
              }
              modifier = {
                  condition = { type = trait value = lazy }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = modest }
                  factor = 1.5
              }
              modifier = {
                  condition = { type = trait value = proud }
                  factor = 0.7
              }
              modifier = {
                  condition = { type = trait value = selfish }
                  factor = 0.7
              }
     }

     action_a = { # Increase royal power
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = energetic }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = set_law value = royal_preorgatory_law }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = energetic }
		}
		effect = { type = prestige scale = 1 }
		effect = { type = loyalty for = random_vassal value = -0.2 }
     }
     action_b = { # Leave things as they are
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = modest }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = loyalty for = random_vassal value = 0.2 }
		effect = { type = prestige scale = -0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = modest }
		}
     }
}

#########################
#Institute lay investiture
#########################
character_event = {
     id = 20021

     picture = "event_religion"
     name = "Investiture controversy"

     trigger = {
              condition = {
                 type = or
                 condition = { type = is_independent }
                 condition = { type = is_vassal }
              }
              condition = { type = religion value = catholic }
              condition = {
                 type = or
                 condition = { type = has_law value = { church_supremacy  = yes } }
                 condition = { type = has_law value = { ecclesical_balance  = yes } }
                 condition = { type = has_law value = { monastic_supremacy  = yes } }
              }
     }

     mean_time_to_happen = {
              months = 480
              modifier = {
                  condition = { type = county }
                  factor = 5
              }
              modifier = {
                  condition = { type = duchy }
                  factor = 2
              }
              modifier = {
                  condition = { type = has_law value = { royal_preorgatory_law  =yes } }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = not
                            value = { type = piety value = 0 }
                  }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = not
                            value = { type = year value = 1150 }
                  }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = trait value = ecclesiastical_education }
                  factor = 2
              }
              modifier = {
                  condition = { type = trait value = detached_priest }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = martial_cleric }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = mastermind_theologian }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = scholarly_theologian }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = zealous }
                  factor = 3
              }
              modifier = {
                  condition = { type = trait value = crusader }
                  factor = 2
              }
              modifier = {
                  condition = { type = trait value = excommunicated }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = trait value = heretic }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = trait value = sceptical }
                  factor = 0.5
              }
     }

     action_a = { # Institute lay investiture
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = sceptical }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = excommunicates }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = heretic }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = selfish }
				factor = 1.25
			}
			#end AI modifier block
		effect = { type = set_law value = regal_supremacy }
		effect = { type = piety scale = -0.5 }
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = sceptical }
		}
		effect = {
			type = random
			chance = 5
			effect = { type = add_trait value = heretic }
		}
     }
     action_b = { # Do not oppose the Church
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = zealous }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = detached_priest }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = martial_cleric }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = scholarly_theologian }
				factor = 1.25
			}
			modifier = { 
				condition = { type = trait value = mastermind_theologian }
				factor = 1.25
			}
			#end AI modifier block
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = zealous }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = piety scale = 0.5 }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = prestige scale = -0.5 }
		}
     }
}

#########################
#Republic
#########################
character_event = {
     id = 20022

     picture = "event_intrigue"
     name = "Popular faction pushes for a republic"

     trigger = {
              condition = {
                 type = or
                 condition = { type = is_independent }
                 condition = { type = is_vassal }
              }
              condition = {
                 type = not
                 value = { type = has_vassal }
              }
              condition = { type = year value = 1150 }
              condition = {
                 type = or
                 condition = { type = has_law value = { royal_preorgatory_law  = yes } }
                 condition = { type = has_law value = { feudal_contract_law  = yes } }
                 condition = { type = has_law value = { traditional_custom_law  = yes } }
              }
              condition = { type = religion value = catholic }
     }

     mean_time_to_happen = {
              months = 2400
              modifier = {
                  condition = { type = duchy }
                  factor = 1.5
              }
              modifier = {
                  condition = { type = kingdom }
                  factor = 3
              }
              modifier = {
                  condition = { type = year value = 1200 }
                  factor = 0.95
              }
              modifier = {
                  condition = { type = year value = 1300 }
                  factor = 0.95
              }
              modifier = {
                  condition = { type = culture value = italian }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = title value = GENO }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = MILA }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = VERO }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = TOSC }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = VENE }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = VENI }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = PISA }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C230 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C233 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C234 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C235 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C317 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C318 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C319 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C320 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C321 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C322 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C323 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C327 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C328 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C329 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C330 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C331 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C350 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C352 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C353 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C354 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C355 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C356 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C357 }
                  factor = 0.9
              }
     }

     action_a = { # Institute a republic
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = just }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = generous }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = set_law value = popular_law }
		effect = { type = set_law value = elective_law }
		effect = { type = prestige scale = -1 }
     }
     action_b = { # Retain current laws
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = selfish }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = arbitrary }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
     }
}

#########################
#Republic coup
#########################
character_event = {
     id = 20023

     picture = "event_intrigue"
     name = "Coup by the noble faction"

     trigger = {
              condition = { type = is_independent }
              condition = { type = year value = 1200 }
              condition = { type = has_law value = { popular_law  = yes } }
              condition = { type = has_law value = { elective_law  = yes } }
              condition = { type = religion value = catholic }
# don't want this happening to established republics
              condition = {
                 type = not
                 value = { type = title value = VENI }
              }
              condition = {
                 type = not
                 value = { type = title value = GENO }
              }
     }

     mean_time_to_happen = {
              months = 2400
              modifier = {
                  condition = { type = duchy }
                  factor = 1.5
              }
              modifier = {
                  condition = { type = kingdom }
                  factor = 3
              }
              modifier = {
                  condition = { type = year value = 1300 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = year value = 1400 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = culture value = italian }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = title value = MILA }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = VERO }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = TOSC }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C230 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C233 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C234 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C235 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C317 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C318 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C319 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C320 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C321 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C322 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C323 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C327 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C328 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C329 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C330 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C331 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C350 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C352 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C353 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C354 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C355 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C356 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = title value = C357 }
                  factor = 0.9
              }
     }

     action_a = { # Install a lord
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = cruel }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = energetic }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = arbitrary }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = set_law value = royal_preorgatory_law }
		effect = { type = set_law value = semisalic_primogeniture_law }
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = arbitrary }
		}
     }
     action_b = { # Keep the republic
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = modest }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = just }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = prestige scale = -0.25 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = just }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = modest }
		}
     }
}

#########################
#Salic Law
#########################
character_event = {
     id = 20024

     picture = "event_intrigue"
     name = "Salic Law"

     trigger = {
              condition = { type = ruler }
              condition = { 
                  type = or
                  condition = { type = has_law value = { royal_preorgatory_law  = yes } }
                  condition = { type = has_law value = { feudal_contract_law  = yes } }
              }
              condition = {
                  type = or
                  condition = { type = has_law value = { semisalic_primogeniture_law  = yes } }
                  condition = { type = has_law value = { salic_consanguinity_law  = yes } }
                  condition = { type = has_law value = { semisalic_consanguinity_law  = yes } }
                  condition = { type = has_law value = { salic_gavelkind_law  = yes } }
                  condition = { type = has_law value = { semisalic_gavelkind_law  = yes } }
              }
              condition = {
                  type = or
                  condition = { type = diplomacy value = 10 }
                  condition = { type = martial value = 10 }
                  condition = { type = stewardship value = 10 }
              }
              condition = { type = religion value = catholic }
     }

     mean_time_to_happen = {
              months = 1200
              modifier = {
                  condition = { type = duchy }
                  factor = 0.75
              }
              modifier = {
                  condition = { type = kingdom }
                  factor = 0.5
              }
              modifier = {
                  condition = { type = year value = 1300 }
                  factor = 0.9
              }
              modifier = {
                  condition = { type = year value = 1400 }
                  factor = 0.9
              }
     }

     action_a = { # Institute Salic Law
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = arbitrary }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = energetic }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = proud }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = selfish }
				factor = 1.5
			}
			modifier = {
				condition = {
					type = any_vassal
					condition = {
						type = not
						value = { type = loyalty value = 1 }
					}
				}
			factor = 0.1
			}
			#end AI modifier block
		effect = { type = set_law value = salic_primogeniture_law }
		effect = { type = prestige scale = 0.5 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = proud }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = arbitrary }
		}
     }
     action_b = { # Keep the old succession laws
		ai_chance = 50
			#start AI modifier block
			modifier = { 
				condition = { type = trait value = coward }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = lazy }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = modest }
				factor = 1.5
			}
			modifier = { 
				condition = { type = trait value = just }
				factor = 1.5
			}
			#end AI modifier block
		effect = { type = prestige scale = -0.1 }
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = just }
		}
		effect = {
			type = random
			chance = 10
			effect = { type = add_trait value = modest }
		}
     }
}

EDIT: fixed some bugs.
 
Last edited: