Fixing db fetch script