improve databag loading logic