Fix bug with samples mismatch