Fix double-encoding messages issue