Fix bug concerning wrong variable usage.