Fixed unicode keys in headers on 2.x

This fixes #452 and #758