Use proper const check instead of implicit relation
Fix encoding of messages delivered by notice callbacks