fix some bugs with init scripts