Virtual Desktop Problem El Capitan

I recently noticed the virtual desktops or Spaces on Mac were not working as expected. They had become locked together and it was not possible to switch on one monitor without switching the second too.

The problem is fixed by ensuring the check box next to Displays have separate Spaces is on under the Mission Control pane in the System Preferences.