Fixed passing of db