better return code handling in restore script