can now cope also with different sample numbers