Add null checking on response parsing