bugfix: encode error message for safety