Replace deprecated function calls with correct equivelent