Fixed nullpointer exception on restore