rather ugly config parsing