Fixed some backup/restore bugs