changed the for loop in databasse