fix undef var
fix query mot query bug