added status code check