Fix bugs for init