fixed bug for wrong variable