parse config more robustly