Fix missing headers and ReadKeyValue