Error handling update

No more errors about undefined things!