fixing https://github.com/pydata/pandas/issues/5372