fix variable scope for $custom_hostname