fixing the problematc main method