Fixed reboot problem in relation to on demand

Closes #1238