some useful functions for arrays