Extracted stripHost and fixed compiler error for ctx;