fix tricky javascript bug in message filter