calloc refs instead of malloc'ing them
Merge pull request #1566 from ethomson/ref_zero

calloc refs instead of malloc'ing them