removed next perm array out of bounds exception throwing mechanism