Bug/backup1

Fixes #1078
and add tests to prevent to happen again