Moved the data directory check before the daemonization

Otherwise you might have absolutely no feedback if something goes wrong
(no log created).