fixing undefined variable errors and replacing calls with set()s