improve configuration reading logic