Fixed backup logic.

Was completely incorrect.