Custom changes made to the config after first initialization got lost after setting work directory. Therefore moved custom initialization into a separate function which is called after setting work directory.