Fix wrong sql statement in offline im.