Fix reference errors

Fixes #127