fix init race that could lead to deadlock in malloc init code