first cut at a fix for https://issues.apache.org/jira/browse/THRIFT-2232