add more error handling to hashname functions
more improvements in error handling and tests