this worked for me.....
I opened wicd and used static ip.

Then used these commands:
iwconfig wlanx mode managed
iwconfig wlanx essid xxxxxx
iwconfig wlanx channel x
iwconfig wlanx key...