fixes up populate db to work with actual line counts