handle undefined responses properly