Remove usage of deprecated  in creating of objects.