a few imrpovements to perl wrapper