fixing utility function