some util functions