changed the basic auth encoding logic