Fixed some read functions to work correctly on undo