Add extra check for length mismatch