update deprecated functions, and fix variable require