Stability of convection rolls in the presence of a vertical magnetic field