Fixed a bug in function for event "UnitCreated"