calloc instead of malloc, this would have prevented a bug earlier!