made config loading more robust (e.g. against error on XML parse etc.), some code cleanup

Change-Id: I3b50f67fb2e6732633679bbced38e5becb0d8166