Most likely the custard wasn't cooked long enough to allow the egg yolks and cornstarch to thicken the chocolate cream mixture. Allowing the custard to cook for an extra minute (the bubbles will be thick and heavy) insures that the custard will set.