replace sizeofstr with strlen