Fixed some errors

Replaced deprecated functions