Added fix for pandas issue, backported from matrix branch.