add safety code to avoid multiple initializations