Fix PRIMARY KEY and parackge.json related bugs