Correct error reporting and check correctly lengths match and test for it.