improve some utilities functions