Fixed some deprecated things and bug