Adding tests for rf_file.h I/O dealing functions. Also contains some fixes for them