Applied some fixes on AMG