changed to deal with https