some useful utilities functions