Fixed random object creation bug