fixed scalproc for nn <= kk (wrong vector used)