database building correctly