fixed a bug when extracting measurements from the database. Training now goes much smoother, but there is still some weirdness.