fixed bug in gen_wl