first attempt at fixing recursive restore