Make sure to get the correct type of variables when compiling ivars.

Fixes #127.