Fix the wrong data type
Fix the wrong conditional compilation
Change variable name
Add the safety checks in the file reader/writer functions