Imperative to ensure proactive legal help in prisons, build social support forundertrials, study says