small fixes. Preparing the system to use it like a daemon