change code to pre if message contains object