As per [this advice][1], I've installed wicd and configured my wifi connection through wicd-curses. And never looked back since.

    sudo apt-get install wicd
    sudo apt-get install wicd-curses

And then setup by running:

    wicd-curses

  [1]: https://coderwall.com/p/v290ta/raspberry-pi-wifi-setup-with-wpa2-psk-aes