properly fix castSource for arrays