Fixed some bugs in Core Data code

The persistent store was failing so initialise itself