[ktest] improve error reporting when config file has invalid format (also fixes a bug)

See commit logs.