some utility functions