Fixed bug for localhost URLs + added more tests