cast to correct type with calloc