replaced malloc+memset with calloc