use calloc instead of memset and get rid of a duplicated field