Fix a bug with wrong core num passed to shared alloc; Tweak core halt code.