diff --git a/source/KKRhost/tmatimp_newsolver.F90 b/source/KKRhost/tmatimp_newsolver.F90
index 128506f04fb5a36be32088f7298ee983e70a75b0..043faf60e987080e7552e89c57f8693039b2bc61 100644
--- a/source/KKRhost/tmatimp_newsolver.F90
+++ b/source/KKRhost/tmatimp_newsolver.F90
@@ -508,7 +508,7 @@ contains
 
       i1 = (korbit+1)*lmmax0d*(korbit+1)*lmmax0d*ihost
       ! Allocation of temp for TMATLL
-      allocate (temp(lmmaxd,lmmaxd,natomimp), stat=i_stat)
+      allocate (temp(lmmaxd,lmmaxd,ihost), stat=i_stat)
       call memocc(i_stat, product(shape(temp))*kind(temp), 'temp', 'tmatimp_newsolver')
       temp = czero
       call mpi_allreduce(tmatll,temp,i1,mpi_double_complex,mpi_sum,mpi_comm_world,ierr)