improved config handler