Problems with double graphic card

Hi to everyone. It’s quite some days that I am having the following problem and I am getting crazy trying to fix it.
First, I am working on a laptop with xubuntu 14.04 with kernel 3.13.0-55 with a 970m and an integrated intel gpu.
I made a clean install of xubuntu and installed the xorg edgers nvidia-346 driver which was working correctly. After that I installed cuda (version 7) and the problems started. When I boot into linux the screen freezes either on the loading circle or with a black screen and I can’t even login on the shell (crtl alt f1). If I choose recovery mode in boot mode and then just press resume I can login but the nvidia driver is not loaded. I have also a led which is indicating which gpu is used. When I boot in this mode it shows that the intel is used. I also installed prime-indicator to see what is used and in this mode I get:

Xlib: extension “GLX” missing on display “:0.0”.
Error: couldn’t find RGB GLX visual or fbconfig

I installed bumblebee and Reinstalled the driver and the system booted correctly with the nvidia driver. I immidiatelly rebooted and again the same problem araised. As soon as the system switches on login on the nvidia card the systems freezes.

I also found out that reinstalling the driver, cuda and bumblebee fixes everything in the sense that I can reboot and login with the nvidia card, but as soon as I reboot again the system freezes again.

Any help would be much appreciated!

Thanks