Fix bug in expiring messaging. Fix #277