made datadir/confdir configurable and added sanity checks