I suppose that you've added some lines like this:
and you say that you've checked that
return some valid info and it isn't saved to file (at a different levels depending of the course)?
Sounds very strange!!
Can you send me a copy of your backuplib.php file? And a copy of your users table (privately)? Then I'll test it....