Some updates to file IO, other misc fixes