common utill function