normilize url before writing, error checks.