mahendar: allocation fixes