fixed invalid write in init methods