tweaked some util functions