Bug fix: Wrong variable being referenced