change window to $window where register success