add check when calloc failed