use calloc instead of malloc and memset
normalize method