Bug fix: use class instance instead of variable