added safeguards so host without ending slash does not crash things

After I had changed some variables to be things that could be customized I realized that the user could easally be tripped up by the requirement that the host variables needs to have a ending slash, this solves that problem, by checking the variables before use and in case it's missing a slash adding it.