fixed a bug where foreign keys to tables unknown in the dataset would
cause an NPE
fixing a couple of bugs related to case-sensistivity in datasets