Error fixing

Partially fixed code so it can run again