light refactor + more info on alloc_id failure

Not sure how the last patch was not rebased against current master, so trying this again!