utility functions for arrays and objects