util for common functions