random permutation function
image type related function fixes