fix overwrite host support and make the code a bit more readable