Subsite site URL gets changes automatically

site_url in the database for subsite gets changed when a user tries to log in to their site after registration. It gets replaced with my main site URL.