Fixed 2 bugs

Fixed 2 bugs in the restore script