changed test for table existence to regular expression as it did not work once the tables existed :(