remove invalid characters in hash keys