Added status code check