Fixed incorrect url building. Added more tests