added condition for replacing https by http