Fix wrong variable access. Closes #30, Closes #31