Fix (array) casting bug