bug fixing for https and http