Fix various warnings, and compilation issues

Also made the hash entry key handling to work. I don't really
understand how Perl is put together and why these SVs don't
seem to know if they are UTF-8 encoded or not. Did anyone really
even try to get this working properly, ever?