Fixed errors in record/playback code.