modified to check https