Fix bug: calculating test_error with test data