Fix undefined variables. Closes #116.