fixed writeInode method