diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h
index 5d83ca9dd9..85e8fc5446 100644
--- a/src/libasr/pass/pass_utils.h
+++ b/src/libasr/pass/pass_utils.h
@@ -584,6 +584,32 @@ namespace LCompilers {
             bool perform_cast=false,
             ASR::cast_kindType cast_kind=ASR::cast_kindType::IntegerToInteger,
             ASR::ttype_t* casted_type=nullptr) {
+            if ( x->m_dt_sym && ASR::is_a<ASR::Struct_t>(*(x->m_dt_sym)) ) {
+                ASR::Struct_t* st = ASR::down_cast<ASR::Struct_t>(x->m_dt_sym);
+                if ( st->n_member_functions > 0 ) {
+                    remove_original_statement = true;
+                    if ( !ASR::is_a<ASR::Var_t>(*(replacer->result_var)) ) { 
+                        throw LCompilersException("Expected a var here");
+                    }
+                    ASR::Var_t* target = ASR::down_cast<ASR::Var_t>(replacer->result_var);
+                    ASR::call_arg_t first_arg;
+                    first_arg.loc = x->base.base.loc; first_arg.m_value = replacer->result_var;
+                    Vec<ASR::call_arg_t> new_args; new_args.reserve(replacer->al,1);
+                    new_args.push_back(replacer->al, first_arg);
+                    for( size_t i = 0; i < x->n_args; i++ ) {
+                        new_args.push_back(replacer->al, x->m_args[i]);
+                    }
+                    ASR::StructType_t* type =  ASR::down_cast<ASR::StructType_t>(
+                                            (ASR::down_cast<ASR::Variable_t>(target->m_v))->m_type);
+                    std::string call_name = "__init__";
+                    ASR::symbol_t* call_sym = get_struct_member(replacer->al,type->m_derived_type, call_name,
+                                                x->base.base.loc, replacer->current_scope);
+                    result_vec->push_back(replacer->al, 
+                                        ASRUtils::STMT(make_call_helper(replacer->al,call_sym,
+                                            new_args,call_name,x->base.base.loc)));
+                    return;
+                }
+            }
             if( x->n_args == 0 ) {
                 if( !inside_symtab ) {
                     remove_original_statement = true;
diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp
index 07e51a924a..1621ff8a29 100644
--- a/src/lpython/semantics/python_ast_to_asr.cpp
+++ b/src/lpython/semantics/python_ast_to_asr.cpp
@@ -5313,17 +5313,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
                 if ( call->n_keywords>0 ) {
                     throw SemanticError("Kwargs not implemented yet", x.base.base.loc);
                 }
-                Vec<ASR::call_arg_t> args;
-                args.reserve(al, call->n_args + 1);
-                ASR::call_arg_t self_arg;
-                self_arg.loc = x.base.base.loc;
-                self_arg.m_value = ASRUtils::EXPR(ASR::make_Var_t(al, x.base.base.loc, sym));
-                args.push_back(al, self_arg);
-                visit_expr_list(call->m_args, call->n_args, args);
-                ASR::symbol_t* der = ASR::down_cast<ASR::StructType_t>((var->m_type))->m_derived_type;
-                std::string call_name = "__init__";
-                ASR::symbol_t* call_sym = get_struct_member(der, call_name, x.base.base.loc);
-                tmp = make_call_helper(al, call_sym, current_scope, args, call_name, x.base.base.loc);
             }
         }
     }
@@ -5618,13 +5607,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
                 if ( call->n_keywords>0 ) {
                     throw SemanticError("Kwargs not implemented yet", x.base.base.loc);
                 }
-                visit_expr_list(call->m_args, call->n_args, new_args);
-                ASR::symbol_t* der = ASR::down_cast<ASR::StructType_t>(
-                    ASR::down_cast<ASR::Variable_t>(st)->m_type)->m_derived_type;
-                std::string call_name = "__init__";
-                ASR::symbol_t* call_sym = get_struct_member(der, call_name, x.base.base.loc);
-                tmp_vec.push_back(make_call_helper(al, call_sym,
-                    current_scope, new_args, call_name, x.base.base.loc));
             }
         }
         // to make sure that we add only those statements in tmp_vec