fix case when sogo module not exists

and simplify code