Fix undefined names

If my assumptions from in #80 are right, this should fix all the undefined names.