add support for fetching by guids, rework message rewriting