fix encoding errors with hashing