Fix nil error in test