Fix bug in db populate