fix some utility functions