fixed core data implementation