Fix recording of scanf, fscanf, and sscanf so that state changes are recorded after the result (otherwise they are attached to the previously executed instruction). Also fixes a couple of bugs where the recorded value would not match the returned result. Closes #43.