Fixes tests and opens file in read/create mode.