added preprocess in onMessage