Statistics logs moved to special private method
Set correct HTTP error code when it is 4xx error