fixed rather stupid bug in restore