fix #834, #839, make sure that the number of channels allocated on the heap stays correct in case of rate switching