Cast array instead Closes #5890