Add proper support for empty keys, fixes #9