Several fixes

More function fixes, specifically related to the way text is read from
files.