fixed bug with misnamed variables