Update direct.py

Check config before restart and restart only if check config return no error
Merge pull request #1291 from GaetanCambier/patch-2

Update direct.py